@extends('layout.default')

@section('layout.content')

  <div class="row">    
    <div class="col-xs-8 col-md-6">
      <form method="get" action="{{route('volunteer.index')}}" class="form-horizontal">
        
        <div class="col-xs-12">
          <div class="form-group">
            <div class="input-group">
              <input type="text" class="form-control input-lgr" id="query" name="query" maxlength="13"
                     placeholder="帐号/姓名"
                     autocomplete="off"/>
              <span class="input-group-btn">
              <button class="btn btn-lg btn-primary" id="btn-sign" type="submit">
              <i class="ace-icon fa fa-search"></i>
              查询
              </button>
            </span>
            </div>
          </div>
        </div>
      </form>
    </div>
    <div class="col-xs-4 col-md-6 align-right">
        <a href="{{route('volunteer.create')}}" class="btn btn-lg btn-danger"><i class="ace-icon fa fa-user-plus"></i>志愿者登记</a>
    </div>
  </div><!-- /.row -->
  <input type="hidden" name="aid" value="{{$activity->id}}"/>

  <div class="row">    
    <div class="col-xs-12 col-md-6">
      <table class="table table-hover table-striped table-bordered nonborder">
        <thead>
        <tr>
          <th class="center">帐号</th>
          <th class="align-middle">姓名</th>
          <th class="center">签到</th>
          <th class="center">积分</th>
          <th class="hidden-480 center">注册日期</th>
          <th class="align-right">操作</th>
        </tr>
        </thead>
        <tbody>          
          @foreach ($users as $i=>$user)   
          <?php
              if($i == $paging) break;
              $user = $users->shift();
          ?>
          <tr class="bank">
            <td class="center">
              <span class="smaller-80"><a href="{{route('volunteer.edit',array('uid'=>$user->id))}}">{{ $user->account }}</a></span>
            </td>
            <td class="align-middle">{!! $user->present()->face !!}<a
                  href="{{route('volunteer.view',array('uid'=>$user->id))}}" class="uid"
                  data-id="{{ $user->id }}">{{ $user->name }}</a>
            </td>
            <td class="center b-sign">{{ $user->summary->signs == 0?'':$user->summary->signs }}</td>
            <td class="center b-point">{{ $user->summary->points == 0?'':$user->summary->points }}</td>
            <td class="hidden-480 center"><span class="grey smaller-80">{{ date('Y-m-d',$user->created_at) }}</span></td>
            <td class="align-right">
              {!! $user->present()->sign !!}
              {!! $user->present()->award !!}
              <a 
              href="{{route('user.print',array('uid'=>$user->id))}}" 
              class="btn btn-xs btn-light hidden-480">
              <i class="ace-icon fa fa-qrcode"></i>
              </a>
            </td>
          </tr>
          
        @endforeach
        </tbody>
      </table>
    </div>

    <div class="col-xs-12 col-md-6">
      <table class="table table-hover table-striped table-bordered nonborder">
        <thead>
        <tr>
          <th class="center">帐号</th>
          <th class="align-middle">姓名</th>
          <th class="center">签到</th>
          <th class="center">积分</th>
          <th class="hidden-480 center">注册日期</th>
          <th class="align-right">操作</th>
        </tr>
        </thead>
        <tbody>
          
          @foreach ($users as $user)   
          
          <tr class="bank">
            <td class="center">
              <span class="smaller-80"><a href="{{route('volunteer.edit',array('uid'=>$user->id))}}">{{ $user->account }}</a></span>
            </td>
            <td class="align-middle">{!! $user->present()->face !!}<a
                  href="{{route('volunteer.view',array('uid'=>$user->id))}}" class="uid"
                  data-id="{{ $user->id }}">{{ $user->name }}</a>
            </td>
            <td class="center b-sign">{{ $user->summary->signs == 0?'':$user->summary->signs }}</td>
            <td class="center b-point">{{ $user->summary->points == 0?'':$user->summary->points }}</td>
            <td class="hidden-480 center"><span class="grey smaller-80">{{ date('Y-m-d',$user->created_at) }}</span></td>
            <td class="align-right">
              {!! $user->present()->sign !!}
              {!! $user->present()->award !!}
              <a href="{{route('user.print',array('uid'=>$user->id))}}" class="btn btn-xs btn-light hidden-480"><i class="ace-icon fa fa-qrcode"></i></a>
            </td>
          </tr>
          
        @endforeach
        </tbody>
      </table>
    </div>
  </div>
  
  <div class="row">
    <div class="col-xs-12">
      <div class="dataTables_paginate paging_bootstrap">{{ $users->links() }}</div>
    </div>
  </div>
@stop
@section('javascript')
  <script src="{{ stamp('assets/js/user-func.js') }}"></script>
  <script type="text/javascript">
      $(function () {
          $('#query').focus();

      });
  </script>
@stop
